package view;

import object.UserAccount;

import com.opensymphony.xwork2.ActionSupport;

import controller.UserAccountController;

public class LoginAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String username;
	private String password;
	private UserAccountController uac;
	public LoginAction(){
		uac = new UserAccountController();
	}
	
	public String authenticate(){
		UserAccount user = uac.authenticate(username, password);
		if(user==null){
			addActionError(getText("error.login"));
			return LOGIN;
		}
		return SUCCESS;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}
